package jdsl.core.ref;

/**
 * This is a class that implements the BNF's definition of a 'attr', or an attribute.
 * It contains two ID's implemented by Strings that both must exist to satisfy the BNF:
 * 
 * attr ::= HASH ID ID
 * 
 * @author Lucas Dreyer
 */
public class Attribute {
	private String ID1;
	private String ID2;
	
	/**
	 * Default Constructor
	 */
	public Attribute() {
		
	}
	
	/**Extended Constructor*/
	public Attribute(String ident1, String ident2) {
		ID1 = ident1;
		ID2 = ident2;
	}

	/**
	 * Returns the Attribute's first ID or identifier.
	 */
	public String getID1() {
		return ID1;
	}
	
	/**
	 * Returns the Attribute's second ID or identifier.
	 */
	public String getID2() {
		return ID2;
	}
	
	/**
	 * Returns a string in the format described by the BNF:
	 * 
	 * attr ::= HASH ID ID
	 * 
	 * Therefore:
	 * \#ID1 ID2
	 * 
	 * For example if ID1 was "name" and ID2 was "page" the output would be:
	 * \#name page  
	 */
	public String toString() {
		return "#" + ID1 + " " + ID2;
	}
}

